package cn.edu.gzhu.workOrderManagement.pojo.entity;

import cn.edu.gzhu.workOrderManagement.enumeration.UserAuthorityEnum;
import cn.edu.gzhu.workOrderManagement.typeHandles.UserAuthorityTypeHandle;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.JdbcType;

import java.time.LocalDateTime;

/**
 * 用户的实体类
 * @author chen xi
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class User {

   /**
    * 用户唯一标识符
    */
   @TableId(type = IdType.AUTO)
   private Long id;

   /**
    * 用户真实姓名
    */
   private String name;

   /**
    * 用户名
    */
   private String username;

   /**
    * 用户密码
    */
   private String password;

   /**
    * 用户归属组织
    */
   private String organization;

   /**
    * 组别
    */
   private Integer teamId;

   /**
    * 账户是否可用
    */
   private Boolean isAvailable;

   /**
    * 用户权限
    */
   @TableField(typeHandler =UserAuthorityTypeHandle.class,jdbcType = JdbcType.VARCHAR)
   private UserAuthorityEnum authority;

   /**
    * 创建时间
    */
   @TableField(fill = FieldFill.INSERT)
   private LocalDateTime createTime;

   /**
    * 更新时间
    */
   @TableField(fill = FieldFill.UPDATE)
   private LocalDateTime updateTime;

}
